package com.evl.api.common.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.evl.api.common.service.IOpendIdService;
import com.evl.core.vo.BaseResultVo;
import com.evl.core.vo.JsonReturnHelper;

/**
 * 
 * @author lilong
 *
 */
@Controller
@RequestMapping("/api/common")
@Api(value = "公共接口")
public class OpendIdController {
	
	@Resource
	private IOpendIdService opendIdService;
	
	/**
	 * 获取getOpendId
	 * @param jsCode
	 * @return
	 */
	@RequestMapping(value ="/getOpendId",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
    @ApiOperation(value="获取getOpendId",httpMethod = "GET", response = BaseResultVo.class, notes = "获取getOpendId")
    @ResponseBody
	public BaseResultVo getOpendId(@ApiParam(required = true, name = "jsCode", value = "获取getOpendId") @RequestParam("jsCode") String jsCode){
		String res=opendIdService.getOpendId(jsCode);
		JSONObject obj = JSONObject.parseObject(res);
		
		return JsonReturnHelper.getSuccessWithData(obj);
	}
}
